/**
 * 收银中心管理初始化
 */
var TOrderFee = {
    id: "TOrderFeecTable",	//表格id
    seItem: null,		//选中的条目
    table: null,
    layerIndex: -1
};

/**
 * 初始化表格的列
 */
TOrderFee.initColumn = function () {
    return [

            {title: '运单单号', field: 'original_num', visible: true, align: 'center', valign: 'middle'},
            {title: '款项类型', field: 'fee_name', visible: true, align: 'center', valign: 'middle'},
            {title: '金额', field: 'money', visible: true, align: 'center', valign: 'middle'},
            {title: '结算方式', field: 'settlementType', visible: true, align: 'center', valign: 'middle',templet: '#selectboxTpl'},
            {title: '记账时间', field: 'create_time', visible: true, align: 'center', valign: 'middle'}

    ];
};

/**
 * 关闭此对话框
 */
TOrderFee.close = function () {
    parent.layer.close(window.parent.TOrderFee.layerIndex);
}
/**
 * 提交修改
 */
TOrderFee.editSubmit = function () {


    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/tOrderFee/update", function (data) {
        Feng.success("操作成功!");
        window.parent.aTable.refresh();
        TOrderFee.close();
    }, function (data) {
        Feng.error("操作失败!" + data.responseJSON.message + "!");
    });
    ajax.set("pay_mode",$('#pay_mode').val()+"");
    ajax.set("ids");
    ajax.set("status",3);
    ajax.set("yjString",yjString.join());
    ajax.start();
}


Array.prototype.remove = function(val) {
    var index = this.indexOf(val);
    if (index > -1) {
        this.splice(index, 1);
    }
};
var aTable = null
var mTable = null;
var mFrom = null;
var yjString=new Array();
$(function () {
    // var defaultColunms = TOrderFee.initColumn();
    // var table = new BSTable(TOrderFee.id, "/tOrderFee/listFee?ids="+$('#ids').val(), defaultColunms);
    // table.setPaginationType("client");
    // table.setPagination(false);
    // table.setShowColumns(false);
    // table.setHeight(300);
    // TOrderFee.table = table.init();
    var defaultColunms = TOrderFee.initColumn();
    aTable = new LYTable(TOrderFee.id, "/tOrderFee/listFee?ids="+$('#ids').val(), defaultColunms);
    // table.setPaginationType("client");
    layui.use('table', function () {
        mTable = layui.table;
        mFrom = layui.form;
        TOrderFee.table = aTable.init(mTable);

        mFrom.on('checkbox(lockDemo)', function(obj){
            if(obj.elem.checked){
                yjString.push(this.value);
            }else{
                yjString.remove(this.value)
            }

        });
    })



});
